class ColorTest < Sketch3D
  def container
    super do
      block { background 0 }

      # Color math examples
      group :tx => -1, :stroke => White do
        colors = [
          [White, Purple * White, Purple],
          [Purple, Purple ^ Red, Red],
          [Blue, Blue % Transparent, Transparent],
          [White, White + Black, Black],
          [White, (Purple^Blue) * White, Purple^Blue, Blue, Blue * Black],
          [Red, Red^Yellow, (Red^Yellow) % Transparent, ((Red^Yellow) % Transparent) * White]
        ]
        colors.each_with_index do |array, x|
          array.each_with_index do |c, y|
            box :fill => c, :tx => x * 0.3, :ty => y * 0.3, :sx => 0.5, :sy => 0.5, :sz => 0.5 do
              block { @ry = pi_pulse(100 + x + y) }
            end
          end
        end
      end

      # Blending of colors
      group :ty => -0.6 do
        group :stroke => Black do
          box :sx => 0.7, :sy => 0.7, :sz => 0.7 do
            block do
              @tx = sin_pulse(1000) / 10.0
              @ty = cos_pulse(1000) / 10.0
              @ry = sin_pulse(20) / 10.0
              @sx = @sy = @sz = 0.8 + sin_pulse(40).abs / 16.0
              @fill = Color.new [pulse(300), 1, 1, smooth_pulse(600) / 2.0 + 0.5]
            end

            box :sx => 0.6, :sy => 0.6, :sz => 0.6 do
              block do
                @tx = sin_pulse(400) * 0.3
                @ty = cos_pulse(400) * 0.3
                @tz = 0.8
                @rz = pi_pulse(300)
                @fill = parent.fill ^ Red * Red
              end
            end

            box :sx => 0.4, :sy => 0.4, :sz => 0.4, :fill => Red do
              block do
                @tx = sin_pulse(400) * 0.5
                @ty = cos_pulse(400) * 0.5
                @tz = 1
                @rz = pi_pulse(150)
              end
            end
          end
        end
      end
    end
  end
end


